<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="lib/css/bootstrap.css">
    <title>Document</title>
    <style>
        body {
            padding-top: 80px;
        }
        img{
           position: absolute;
           right: 200px;
           top: 13px;
       }
       .content{
           color: white;
           position: absolute;
           right: 260px;
           top: 15px;
       }
       .text{
           font-size: 18px;
           color: cadetblue;
           cursor: pointer;
       }
       .ip{
           color: gray;
           font-size: 15px;
       }
       .time{
            font-size: 15px;
            margin-left: 15px;
            color: gray;
       }
    </style>
</head>

<body>
    <nav class="navbar navbar-inverse navbar-fixed-top">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false"
                    aria-controls="navbar">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#">智游教育</a>
            </div>
            <div id="navbar" class="collapse navbar-collapse">
                <ul class="nav navbar-nav">
                    <li class="active"><a href="regist.html">注册</a></li>
                    <li><a href="login.html">登录</a></li>
                    <li><a href="user.html">个人中心</a></li>
                    <li><a href="ask.html">问题</a></li>
                    <li><a href="#contact">退出</a></li>
                </ul>
            </div>
            <span class="content"></span>
            <img src="img/photo.jpg" alt="" style="width:28px;height:28px;">

        </div>
    </nav>

    <div class="box">

        </div>
            <div class="container">
                {{each data m i}}
                <p class="text" onclick="location.href='reply.html'">{{m.content}}</p>
                <p>
                    <span class="ip">{{m.ip | formatIP}}</span>
                    <span class="time">{{m.time | formatTime}}</span>
                </p>
                {{/each}}
            </div>
    <script src="lib/jquery.js"></script>
    <script src="lib/js/bootstrap.js"></script>
    <script src="lib/jquery.cookie.js"></script>
    <script src="/lib/template.js"></script>

    <script>
        if ($.cookie('username')) {
            $('img').attr('src', 'uploads/' + $.cookie('username') + '.jpg');
            // 如果有用户登录，显示用户名
            $('.content').text($.cookie('username'));
        }
    </script>
</body>

</html>